function mutated = mutation(mutationType, population, genIndex)
    global mutationProb weightsSize;
   
    mutated.individuals = population.individuals;
    localMutationProb = mutationProb;
        
    if mutationType == 2 %NOT UNIFORM
        localMutationProb = localMutationProb * (0.99^genIndex);
    end
    
    for i = 1:length(population.individuals)
        minValue = min(population.individuals{i});
        maxValue = max(population.individuals{i});
        
        for j=1:weightsSize
            if rand() < localMutationProb
                newValue = rand() * (maxValue-minValue) + minValue;
                mutated.individuals{i}(j) = newValue;
            end
        end
        mutated.fitness(i) = main(mutated.individuals{i});
    end
end

